package com.run.motion.service.impl;

import java.util.List;

import com.run.motion.entity.Comment;
import com.run.motion.mapper.CommentMapper;
import com.run.motion.service.ICommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 评论Service业务层处理
 * 
 * @author lyq
 * @date 2022-03-26
 */
@Service
public class CommentServiceImpl implements ICommentService
{
    @Autowired
    private CommentMapper commentMapper;

    /**
     * 查询评论
     * 
     * @param pid 评论主键
     * @return 评论
     */
    @Override
    public Comment selectCommentByPid(Long pid)
    {
        return commentMapper.selectCommentByPid(pid);
    }

    /**
     * 查询评论列表
     * 
     * @param comment 评论
     * @return 评论
     */
    @Override
    public List<Comment> selectCommentList(Comment comment)
    {
        return commentMapper.selectCommentList(comment);
    }
    /**
     * 根据mid查询评论列表
     *
     * @param mid 动态id
     * @return 评论集合
     */
    public List<Comment> selectCommentByMidList(Long mid){
        return commentMapper.selectCommentByMidList(mid);
    }
    /**
     * 新增评论
     * 
     * @param comment 评论
     * @return 结果
     */
    @Override
    public int insertComment(Comment comment)
    {
        return commentMapper.insertComment(comment);
    }

    /**
     * 修改评论
     * 
     * @param comment 评论
     * @return 结果
     */
    @Override
    public int updateComment(Comment comment)
    {
        return commentMapper.updateComment(comment);
    }

    /**
     * 批量删除评论
     * 
     * @param pids 需要删除的评论主键
     * @return 结果
     */
    @Override
    public int deleteCommentByPids(Long[] pids)
    {
        return commentMapper.deleteCommentByPids(pids);
    }

    /**
     * 删除评论信息
     * 
     * @param pid 评论主键
     * @return 结果
     */
    @Override
    public int deleteCommentByPid(Long pid)
    {
        return commentMapper.deleteCommentByPid(pid);
    }
}
